from django.conf.urls.defaults import *
from django.contrib import admin
from django.views.generic import list_detail

from settings import DEBUG, ALBUM_TYPES

from gallery import views
from gallery.models import Picture

albtypes_urls = '|'.join([type[0] for type in ALBUM_TYPES])

admin.autodiscover()

urlpatterns = patterns('',
    # Example:
    # (r'^mysite/', include('mysite.apps.foo.urls.foo')),
    (r'^$', views.index),
    (r'^(?P<alb_type>%s)/$' % albtypes_urls, views.list_albums),
    (r'^album/(?P<album_id>\d+)/', views.list_images),
    (r'^image/(?P<object_id>\d+)/', list_detail.object_detail,
                                {'queryset': Picture.objects.all(),
                                'template_object_name': 'picture'}),
    # Uncomment this for admin:
    (r'^admin/(.*)', admin.site.root),
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
)
if DEBUG:
    urlpatterns += patterns('',
    (r'^media/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': '/home/sterkrig/mariamik-personal/media/'}))
